package ex.com.jm.food.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Email;


/**
 * 企业实体层
 * @author zhaojw
 *
 */
@Entity
@Table(name="jm_company")
public class Company implements Serializable {


	private static final long serialVersionUID = 1L;

	@Id
	@GenericGenerator(name="com_id",strategy="uuid")
	@GeneratedValue(generator="com_id")
	@Column(name="com_id",nullable=false,unique=true,length=32)
	private String comId;//企业主键id'
	@Column(name="com_name",nullable=false,unique=true,length=32)
	private String comName;//企业名称
	@Column(name="com_email",nullable=false,unique=true,length=32)
	@Email(message="邮箱非法")
	private String comEmail;//企业注册级登录邮箱
	@Column(name="com_pwd",nullable=false,length=128)
	private String comPwd;//企业密码
	@Column(name="create_id",nullable=true,unique=false,length=32)
	private String createId;//创建帐号管理员id'
	@Column(name="created",nullable=false,unique=false,length=32)
	private String created;//帐号创建时间
	@Column(name="status",nullable=false,length=11)
	private int status;//帐号启用状态1：启用，0停用
	@Column(name="bank_card",nullable=true,unique=true,length=32)
	private String bankCard;//企业银行卡号或者支付宝帐号
	@Column(name="profit",nullable=true,length=11)
	private int profit;//此处在数据库中只存整数，计算时应除以100
	@Column(name="com_address",nullable=true,length=32)
	private String comAddress;//企业地址
	@Column(name="com_phone",nullable=true,length=32)
	private String comPhone;//企业联系电话
	@Column(name="com_user",nullable=true,length=32)
	private String comUser;//企业联系人，即注册人姓名
	@Column(name="id_card",nullable=true,length=32)
	private String idCard;//企业联系人的身份证证件照;
	@Column(name="com_power",length=32)
	private String comPower;//企业权限，比如是否具有上传菜品权限
	@Column(name="com_image",length=32)
	private String comImage;//企业头像
	@Column(name="com_distr",length=32)
	private Double comDistr;//配送要求,起送价格
	@Column(name="com_discount",length=32)
	private String comDisCount;//优惠活动以";"连接
	@OneToMany(mappedBy="comId",fetch=FetchType.EAGER)
	private Set<Menu> menus=new HashSet<Menu>();
	@OneToMany(mappedBy="comId",fetch=FetchType.EAGER)
	private Set<Evaluation> evals=new HashSet<Evaluation>();
	@OneToMany(mappedBy="comId",fetch=FetchType.EAGER)
	private Set<Order> orders=new HashSet<Order>();
	@OneToMany(mappedBy="comId",fetch=FetchType.EAGER)
	private Set<Comment> cments=new HashSet<Comment>();
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="comtype_id")
	private CompanyType comtypeId;//企业类型
	public String getComId() {
		return comId;
	}
	public void setComId(String comId) {
		this.comId = comId;
	}
	public String getComName() {
		return comName;
	}
	public void setComName(String comName) {
		this.comName = comName;
	}
	public String getComEmail() {
		return comEmail;
	}
	public void setComEmail(String comEmail) {
		this.comEmail = comEmail;
	}
	public String getComPwd() {
		return comPwd;
	}
	public void setComPwd(String comPwd) {
		this.comPwd = comPwd;
	}
	public String getCreateId() {
		return createId;
	}
	public void setCreateId(String createId) {
		this.createId = createId;
	}
	public String getCreated() {
		return created;
	}
	public void setCreated(String created) {
		this.created = created;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public String getBankCard() {
		return bankCard;
	}
	public void setBankCard(String bankCard) {
		this.bankCard = bankCard;
	}
	public int getProfit() {
		return profit;
	}
	public void setProfit(int profit) {
		this.profit = profit;
	}
	public String getComAddress() {
		return comAddress;
	}
	public void setComAddress(String comAddress) {
		this.comAddress = comAddress;
	}
	public String getComPhone() {
		return comPhone;
	}
	public void setComPhone(String comPhone) {
		this.comPhone = comPhone;
	}
	public String getComUser() {
		return comUser;
	}
	public void setComUser(String comUser) {
		this.comUser = comUser;
	}
	public String getIdCard() {
		return idCard;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	public Set<Menu> getMenus() {
		return menus;
	}
	public void setMenus(Set<Menu> menus) {
		this.menus = menus;
	}
	public String getComPower() {
		return comPower;
	}
	public void setComPower(String comPower) {
		this.comPower = comPower;
	}
	public Set<Comment> getCments() {
		return cments;
	}
	public void setCments(Set<Comment> cments) {
		this.cments = cments;
	}
	public CompanyType getComtypeId() {
		return comtypeId;
	}
	public void setComtypeId(CompanyType comtypeId) {
		this.comtypeId = comtypeId;
	}
	public String getComImage() {
		return comImage;
	}
	public void setComImage(String comImage) {
		this.comImage = comImage;
	}
	public Double getComDistr() {
		return comDistr;
	}
	public void setComDistr(Double comDistr) {
		this.comDistr = comDistr;
	}
	public Set<Evaluation> getEvals() {
		return evals;
	}
	public void setEvals(Set<Evaluation> evals) {
		this.evals = evals;
	}
	public Set<Order> getOrders() {
		return orders;
	}
	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}
	public String getComDisCount() {
		return comDisCount;
	}
	public void setComDisCount(String comDisCount) {
		this.comDisCount = comDisCount;
	}
	
	
}
